import request from '@/utils/request'

// 获取轮播图列表
export function getCarousels(params) {
  return request({
    url: '/carousels/list',
    method: 'get',
    params
  })
}

// 获取轮播图详情
export function getCarousel(id) {
  return request({
    url: `/carousels/${id}`,
    method: 'get'
  })
}

// 创建轮播图
export function createCarousel(data) {
  return request({
    url: '/carousels',
    method: 'post',
    data
  })
}

// 更新轮播图
export function updateCarousel(data) {
  return request({
    url: `/carousels/${data.id}`,
    method: 'put',
    data
  })
}

// 删除轮播图
export function deleteCarousel(id) {
  return request({
    url: `/carousels/${id}`,
    method: 'delete'
  })
}

// 更新轮播图状态
export function updateCarouselStatus(id, status) {
  return request({
    url: `/carousels/${id}/status`,
    method: 'put',
    data: { status }
  })
}
